Repository navigation
feat(app-shell): send the console UI language as context.uiLocale on the AI chat request - #34845
Conversation
…the AI chat request ChatPane already resolves the console's language; it now rides the chat request body beside agentName/activeApp/packageId/surface, so the server can name a card control the way the card renders it. The console dock mounts the same ChatPane and is covered by the same change. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrh8TiPJf1i2kMSoa
|
repo:objectstack#3 · os-support-ai · session_01WGufzfrh8TiPJf1i2kMSoa Red check read (area o3-H) · 2026-11-17T13:38Z
Every other hit in the job is a pre-existing |
…render-time write The uiLocale probe assigned a module-level variable during render, which react-hooks/globals rejects. It now reports the resolved language through a callback prop from an effect; render() flushes effects before it returns, so every assertion reads the same value as before. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrh8TiPJf1i2kMSoa
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 review (L1-d) · 2026-11-17T14:42ZL1: ACCEPT Read at that head: the file list (3 paths), the full diff, the PR body, card #34639 with triage 6938637776, claim 6947851082, os-dev reports 6949522160 (round 1, head 82eed1d) and 6951234325 (fix round, head 06a6d9c), and the 52 check-runs. This is the first L1 read of this PR. Checklist
Must-fixNone. Should-fixNone. Notes
Landing: not governed, all checks green. Area o3-H lands it. A later push owes a delta read. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfrh8TiPJf1i2kMSoa Landing (area o3-H) · 2026-11-17T14:43Z
State change: ready + auto-merge enabled; |
Requested by Yibo Wang · project thread
Fixes #34639
Clause-②: no
Metadata-protocol: none
维护者速读
body.context新增uiLocale,值为控制台当前解析出的界面语言(useObjectTranslation().language),其余字段不变。Accept-Language,中文提问 + 英文控制台时,回复让用户点「开始搭建」,而计划卡按钮显示的是 "Build it";cloud PR fix(objectql,cli): 巡检随引擎一起停 ——unreadableObjects不再被关停污染 (#4747) #4815 的consoleUiLocaleOf读这个键来选按钮文案。ui/packages/app-shell/src/console/ai/AiChatPage.tsx(useObjectChat的body.context末尾新增的uiLocale: language一行);ui/packages/app-shell/src/console/ai/__tests__/AiChatPage.uiLocale-34639.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/console/ai/__tests__/AiChatPage.uiLocale-34639.test.tsx,预期 5 个测试全部通过。What changes
ChatPane(AiChatPage.tsx) already readconst { t, language } = useObjectTranslation(). TheuseObjectChat({ body: { context } })call now addsuiLocale: languagebesideactiveApp,agentName,autoPublishAiBuilds,packageIdandsurface. The value is sent as is; there is no client-side normalisation, because the consumer (objectstack-ai/cloud PR fix(objectql,cli): 巡检随引擎一起停 ——unreadableObjects不再被关停污染 (#4747) #4815,consoleUiLocaleOf) validates it.ui/packages/app-shell/src/layout/ChatDock.tsxandChatDockConversation.tsx. The dock does not build its own chat request. It mounts the sameChatPane, so this one change covers the dock too. No dock file is edited. The only non-testuseObjectChat(call sites underui/packagesareAiChatPage.tsxand the SDUIplugin-chatbotrenderer, which is not the console's AI chat..changeset/34639-ai-chat-ui-locale.md,@object-ui/app-shellpatch.Tests
New file
AiChatPage.uiLocale-34639.test.tsx. It rendersChatPanewith a realI18nProviderand withuseObjectChatreplaced by an options recorder, the same harness asAiChatPage.surfaceChipLabel-8219.test.tsx. The expected value is read from a probe under the same provider, so the pin does not depend on how the provider spells a tag. It checks:en/zh/deconsoles:context.uiLocaleequals the resolved UI language (non-empty string).agentName,autoPublishAiBuilds,uiLocalefor a pane with no app, package or surface.No shared ChatPane harness file exists under
console/ai/__tests__/, so the pin is its own card-named file.Targeted run on head 82eed1d (after merging origin/main dfbc316)
Ablation (fix committed first; mutation through scripts/ablation-replace.mjs)
Deleted the line
uiLocale: language,(anchor 1 -> 0, blob 6e4da2c7 -> e6d51027). The test imports../AiChatPagefrom source, so no build step sits between the mutation and the run.Acceptance notes
AiChatPage.tsx, merged before this PR opened. The branch merged origin/main (dfbc316) cleanly.overlap-checkon head 82eed1d reportedVERDICT clean exit 0(origin/main merges cleanly, 0 overlapping PR heads).Verification
Local gate families on head 82eed1d (dispatch-gates --commands, 38 derived)
pnpm --dir ui exec vitest run scripts/(Tests 5077 passed, 2 skipped),pnpm check:nul-bytes,pnpm check:cross-package-test-inputs,pnpm check:test-source-alias,pnpm check:type-check-coverage,pnpm check:type-check-debt,node scripts/check-adr-0087-registration.mjs --base origin/main,node scripts/check-empty-changeset.mjs --base origin/mainandnode scripts/check-sdui-manifest.mjs.dispatch-gates --ran:38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED.pnpm check:changeset-fixed(its roster sits under.changeset/) exit 0.pnpm check:new-line-citations(ui) gaveVERDICT new-cross-file-line-citations: 0 new citation(s).test:repobelong to CI.Generated by Claude Code